William Sitgreaves Cox (1790–1874) was a third lieutenant serving on USS Chesapeake during the War of 1812. During the battle with HMS Shannon in 1813, Cox served below decks in charge of a gun crew. When his crew abandoned their post, Cox went to the deck to continue fighting. Captain James Lawrence was wounded, and Lt. Cox took him below deck. However, all other officers had been seriously wounded or killed, so Lawrence's incapacitation left Cox, the senior non-wounded officer, the ship's commanding officer. It is not clear that he realized that he now was the acting commanding officer. He was convicted in 1814 by court-martial of dereliction of duty, for abandoning his watch station while under fire. He was discharged from the United States Navy in disgrace.
Cox's great-grandson, Electus D. Litchfield, campaigned for nearly 20 years to have the conviction overturned. In 1952, after passage of a resolution of Congress in support of Cox, President Harry S Truman cleared Cox's name and restored his rank.
In chapter 12 of his 1959 novel Starship Troopers, Robert A. Heinlein refers to this story as an illustration of line officers and the importance of maintaining a proper chain of command. In the future history in which the novel was set, however, Lt. Cox does not seem to have been cleared of the charges.